<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/pdf.mjs"></script>
    <script src="./js/pdf.worker.mjs"></script>
</head>
<body>
<div>
    <canvas id="myCanvas"></canvas>
</div>
</body>
</html>
<script>
    var loadingTask = pdfjsLib.getDocument('https://study.hnshengzhong.cn/uploads/pdf/jlbjl.pdf')

    loadingTask.promise.then(function (pdf) {
        for (var i = 1; i <= pdf.numPages; i++) {
            pdf.getPage(1).then(function (page) {
                var scale = 2
                var viewport = page.getViewport({ scale: scale })

                var canvas = document.getElementById('myCanvas')
                var context = canvas.getContext('2d')
                canvas.height = viewport.height
                canvas.width = viewport.width

                var renderContext = {
                    canvasContext: context,
                    viewport: viewport,
                };
                page.render(renderContext);
            })
        }
    });
</script>
